Computer science Lesson Plan
Class: 7th - Lesson:10 Functions(Predefined, User defined)

Purpose: Students will learn about predefined and user-defined functions and how to create reusable code using Scratch's My Blocks.

No. of Classes

One or two classes (Teacher's decision).

Materials Required

Computer, Scratch 3.0 and internet connection (for Code.org).

Curriculum Content
  • 2.7)Functions
  • 2.9)Blocks
  • Prior knowledge

    Students should know what a function is and should be familiar with the basic concepts of Scratch.

    Exercises

    Exercise:1



  • Create a scratch code to make a sprite walk. ( After doing this exercise Teacher has to explain that this code is done by using the pre-defined (inbuilt) functions in scratch.)
  • Exercise:2



  • There are multiple pumpkins in each patch! Look carefully at the function definitions below to figure out how to use each one.
  • No Image

    Click here to play this level.

    Exercise:3



  • Write an improved code for finding prime numbers from 2 to N. Here you have to get the N value from the user. Store the prime numbers as we are finding them in the list. Use a user-defined block to check if a number is a prime number and insert it into a list.
  • Solutions



  • Link to copy solution program for exercise-1.
  • Link to copy solution program for exercise-3.

  • Teacher's Instruction
    1. Teachers should create their own activities to help students understand predefined functions using Scratch blocks.
    2. Teachers can use the video to know about pre-defined and user-defined functions.
    3. POINTS TO PONDER :Do you know about Modules?.